home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Control Strip / MacCalendar ƒ / Src / MacCalendarSetup.r < prev    next >
Encoding:
Text File  |  1994-10-20  |  14.1 KB  |  546 lines  |  [TEXT/KAHL]

  1. /*                                    MacCalendarSetup.r                                */
  2. /*
  3.  * MacCalendarSetup.r
  4.  * Copyright © 1994 Martin Minow. All rights reserved.
  5.  */
  6. #define REZ
  7. #define  SystemSevenOrLater 1
  8. #include "Pict.r"
  9. #include "Types.r"
  10. #include "SysTypes.r"
  11. #include "BalloonTypes.r"
  12. #include "MacCalendarSetup.h"
  13. #if MPW
  14. include "::MacCalendarSetupIcons.rsrc";
  15. #endif
  16.  
  17. /*
  18.  * Boilerplate
  19.  */
  20.  
  21. resource 'vers' (1) {
  22.     kVersionMajor, kVersionMinor, kVersionStage, kVersionRelease, verUS,
  23.     kVersionIdent,
  24.     kVersionString
  25. };
  26.  
  27. type kSetupAppCreator as 'STR ';
  28.  
  29. resource kSetupAppCreator (0) {
  30.     "MacCalendarSetup: " kVersionString
  31. };
  32. resource 'BNDL' (BNDL_SetupApp) {
  33.     kSetupAppCreator, 0,
  34.     {
  35.         'FREF', {0, FREF_SetupApp};
  36.         'ICN#', {0, ICON_SetupApp};
  37.     }
  38. };
  39.  
  40. resource 'FREF' (FREF_SetupApp) {
  41.     'APPL', 0, ""
  42. };
  43.  
  44. resource 'DLOG' (DLOG_Setup, "Setup Dialog", purgeable) {
  45.         {  0 + 30, 0 + 30, 320 + 30, 290 + 30 },
  46.         dBoxProc,
  47.         invisible,
  48.         noGoAway,
  49.         0,
  50.         DLOG_Setup,
  51.         "",
  52. #if SystemSevenOrLater
  53.         alertPositionMainScreen
  54. #endif
  55. };
  56.  
  57. resource 'DITL' (DLOG_Setup, "Setup Dialog", preload, purgeable) {
  58.     {
  59.         { 288, 200, 308, 280 },    Button        { enabled, "OK"                        },
  60.         { 288,   4, 308,  80 },    Button        { enabled, "Cancel"                    },
  61.         {   4,   4, 176, 286 }, UserItem    { disabled /* Sample calendar */    },
  62. #define kFontPopupRect        { 230,  10, 250, 160 }
  63.         kFontPopupRect,            Control        { enabled, CNTL_FontPopup            },
  64. #define kFontSizePopupRect    { 230, 170, 250, 280 }
  65.         kFontSizePopupRect,        Control        { enabled, CNTL_SizePopup            },
  66. #define kFirstDayPopupRect    { 260,  10, 280, 280 }
  67.         kFirstDayPopupRect,        Control        { enabled, CNTL_FirstDayPopup        }, 
  68.         { 180,  10, 196, 282 }, UserItem    { disabled, /* Day labels */        },
  69.         { 200,    10, 216,  42 },    EditText    { enabled,    "Su"                    },
  70.         { 200,    50, 216,  82 },    EditText    { enabled,    "M"                        },
  71.         { 200,    90, 216, 122 },    EditText    { enabled,    "Tu"                    },
  72.         { 200, 130, 216, 162 },    EditText    { enabled,    "W"                        },
  73.         { 200, 170, 216, 202 },    EditText    { enabled,    "Th"                    },
  74.         { 200, 210, 216, 242 },    EditText    { enabled,    "F"                        },
  75.         { 200, 250, 216, 282 },    EditText    { enabled,    "Sa"                    },
  76. #if DEBUG
  77.         /*
  78.          * This lets us test the drawing algorithm without rebuilding the
  79.          * actual status bar and rebooting the machine.
  80.          */
  81.         { 288,  88, 308, 133 },    Button        { enabled, "Prev"                    },
  82.         { 288, 143, 308, 188 },    Button        { enabled, "Next"                    },
  83. #endif
  84.         { 309,  4, 319,   80 }, UserItem    { disabled, /* Version number */    },
  85.         {  0,   0,   0,    0 }, HelpItem    { disabled, HMScanhdlg { HELP_Setup }},
  86.     }
  87. };
  88.  
  89. resource 'hdlg' (HELP_Setup, "Setup Dialog Help", purgeable) {
  90.         HelpMgrVersion,            /* Help version                */
  91.         0,                        /* Offset to first ditl        */
  92.         0,                        /* Options                    */
  93.         0,                        /* The Proc                    */
  94.         0,                        /* Variant                    */
  95.         HMSkipItem { },            /* No missing item strings    */
  96.         {
  97.             HMStringResItem {        /* kOKButton            */
  98.                 { 0, 0 }, { 0, 0, 0, 0 },
  99.                 STRN_SetupHelp, 1,
  100.                 0, 0,
  101.                 0, 0,
  102.                 0, 0
  103.             },
  104.             HMStringResItem {        /* kCancelButton        */
  105.                 { 0, 0 }, { 0, 0, 0, 0 },
  106.                 STRN_SetupHelp, 2,
  107.                 0, 0,
  108.                 0, 0,
  109.                 0, 0
  110.             },
  111.             HMStringResItem {        /* kCalendarUserItem    */
  112.                 { 0, 0 }, { 0, 0, 0, 0 },
  113.                 STRN_SetupHelp, 3,
  114.                 STRN_SetupHelp, 3,
  115.                 STRN_SetupHelp, 3,
  116.                 STRN_SetupHelp, 3,
  117.             },
  118.             HMStringResItem {        /* kFontNamePopupItem    */
  119.                 { 0, 0 }, { 0, 0, 0, 0 },
  120.                 STRN_SetupHelp, 4,
  121.                 STRN_SetupHelp, 4,
  122.                 STRN_SetupHelp, 4,
  123.                 STRN_SetupHelp, 4,
  124.             },
  125.             HMStringResItem {        /* kFontSizePopupItem    */
  126.                 { 0, 0 }, { 0, 0, 0, 0 },
  127.                 STRN_SetupHelp, 5,
  128.                 STRN_SetupHelp, 5,
  129.                 STRN_SetupHelp, 5,
  130.                 STRN_SetupHelp, 5,
  131.             },
  132.             HMStringResItem {        /* kFirstDayPopupItem    */
  133.                 { 0, 0 }, { 0, 0, 0, 0 },
  134.                 STRN_SetupHelp, 6,
  135.                 STRN_SetupHelp, 6,
  136.                 STRN_SetupHelp, 6,
  137.                 STRN_SetupHelp, 6,
  138.             },
  139.             HMSkipItem { },            /* kDayNameUserItem        */
  140.             HMStringResItem {        /* kSundayText            */
  141.                 { 0, 0 }, { 0, 0, 0, 0 },
  142.                 STRN_SetupHelp, 7,
  143.                 STRN_SetupHelp, 7,
  144.                 STRN_SetupHelp, 7,
  145.                 STRN_SetupHelp, 7,
  146.             },
  147.             HMStringResItem {        /* kMondayText            */
  148.                 { 0, 0 }, { 0, 0, 0, 0 },
  149.                 STRN_SetupHelp, 8,
  150.                 STRN_SetupHelp, 8,
  151.                 STRN_SetupHelp, 8,
  152.                 STRN_SetupHelp, 8,
  153.             },
  154.             HMStringResItem {        /* kTuesdayText            */
  155.                 { 0, 0 }, { 0, 0, 0, 0 },
  156.                 STRN_SetupHelp, 9,
  157.                 STRN_SetupHelp, 9,
  158.                 STRN_SetupHelp, 9,
  159.                 STRN_SetupHelp, 9,
  160.             },
  161.             HMStringResItem {        /* kWednesdayText        */
  162.                 { 0, 0 }, { 0, 0, 0, 0 },
  163.                 STRN_SetupHelp,10,
  164.                 STRN_SetupHelp,10,
  165.                 STRN_SetupHelp,10,
  166.                 STRN_SetupHelp,10,
  167.             },
  168.             HMStringResItem {        /* kThursdayText        */
  169.                 { 0, 0 }, { 0, 0, 0, 0 },
  170.                 STRN_SetupHelp,11,
  171.                 STRN_SetupHelp,11,
  172.                 STRN_SetupHelp,11,
  173.                 STRN_SetupHelp,11,
  174.             },
  175.             HMStringResItem {        /* kFridayText            */
  176.                 { 0, 0 }, { 0, 0, 0, 0 },
  177.                 STRN_SetupHelp,12,
  178.                 STRN_SetupHelp,12,
  179.                 STRN_SetupHelp,12,
  180.                 STRN_SetupHelp,12,
  181.             },
  182.             HMStringResItem {        /* kSaturdayText        */
  183.                 { 0, 0 }, { 0, 0, 0, 0 },
  184.                 STRN_SetupHelp,13,
  185.                 STRN_SetupHelp,13,
  186.                 STRN_SetupHelp,13,
  187.                 STRN_SetupHelp,13,
  188.             },
  189.         }
  190. };
  191.  
  192. resource 'STR#' (STRN_SetupHelp, "Setup Dialog Help Strings", purgeable) {
  193.     {    /* [1]    kOKButton                                    */
  194.         "Click this button to update the MacCalendar parameter"
  195.         " resource. Changes take effect after you restart"
  196.         " the computer.",
  197.         /* [2]    kCancelButton                                */
  198.         "Click this button to exit the MacCalendar Setup application"
  199.         " without changing the MacCalendar parameter resource.",
  200.         /* [3] kCalendarUserItem                            */
  201.         "This shows what the calendar will look like after"
  202.         " you click the OK button and restart your computer.",
  203.         /* [4] kFontNamePopupItem                            */
  204.         "This popup menu lets you select the font used to"
  205.         " display the calendar.",
  206.         /* [5] kFontSizePopupItem                            */
  207.         "This popup menu lets you select the font size used"
  208.         " to display the calendar.",
  209.         /* [6] kFirstDayPopupItem                            */
  210.         "This popup menu lets you select the first (leftmost)"
  211.         " day of the week: either Sunday or Monday.",
  212.         /* [7] kSundayText                                    */
  213.         "Sunday: the first day of the week. Derived from late"
  214.         " Latin “dies solis” - day of the sun.",
  215.         /* [8] kMondayText                                    */
  216.         "Monday: the second day of the week. Derived from late"
  217.         " Latin “Lunæ dies” - moon’s day (compare French Lundi).",
  218.         /* [9] kTuesdayText                                    */
  219.         "Tuesday: the third day of the week. Derived from Old"
  220.         " High German “Zîo,” an ancient Teutonic diety, identified"
  221.         " with the Roman Mars; whence “Tíwesdag,” rendering"
  222.         " late Latin “dies Martis” (compare French Mardi).",
  223.         /* [10] kWednesdayText                                */
  224.         "Wednesday: the fourth day of the week. “The day of"
  225.         " (the god) Woden,” a translation of late Latin"
  226.         " “Mercurii dies” whence the name of the day in"
  227.         " the Romance languages.",
  228.         /* [11] kThursdayText                                */
  229.         "Thursday: the fifth day of the week. Derived mainly from"
  230.         " Old Norse “Tórsdagr” ‘day of Thunor or Thor.’ Middle"
  231.         " Germanic Donderday (modern German Donnerstag) derives"
  232.         " from late Latin ”dies Jovis” (compare French Jeudi).",
  233.         /* [12] kFridayText                                    */
  234.         "Friday: the sixth day of the week. Derived from Old"
  235.         " English “Frígedæg” ‘day of (the goddess) Fríg’ from"
  236.         " Old Norse “Frigg” the wife of Odin.",
  237.         /* [13] kSaturdayText                                */
  238.         "Saturday: the seventh day of the week. A half-translated"
  239.         " adoption of Latin “Saturni dies” ‘day of (the planet)"
  240.         " Saturn.’",
  241.     }
  242. };
  243.  
  244. resource 'CNTL' (CNTL_FontPopup, preload, purgeable) {
  245.     kFontPopupRect,                        /* Must match DITL above            */
  246.     popupTitleLeftJust,                    /* Left-justify                        */
  247.     visible,
  248.     41,                                    /* Title width                        */
  249.     MENU_Font,                            /* Font menu                        */
  250.     popupMenuCDEFProc,                    /* It's a popup menu                */
  251.     0,                                    /* refCon, unused                    */
  252.     "Font:"                                /* Title                            */
  253. };
  254.  
  255. resource 'MENU' (MENU_Font, "Font Menu") {
  256.     MENU_Font,
  257.     textMenuProc,
  258.     allEnabled,
  259.     enabled,
  260.     "Font",
  261.     { }
  262. };
  263.  
  264. resource 'CNTL' (CNTL_SizePopup, preload, purgeable) {
  265.     kFontSizePopupRect,                    /* Must match DITL above            */
  266.     popupTitleLeftJust | popupFixedWidth, /* Left-justify                    */
  267.     visible,
  268.     41,                                    /* Title width                        */
  269.     MENU_FontSize,                        /* Font Size menu                    */
  270.     popupMenuCDEFProc,                    /* It's a popup menu                */
  271.     0,                                    /* refCon, unused                    */
  272.     "Size:"                                /* Title                            */
  273. };
  274.  
  275. resource 'MENU' (MENU_FontSize, "Font Size Menu") {
  276.     MENU_FontSize,
  277.     textMenuProc,
  278.     allEnabled,
  279.     enabled,
  280.     "Size",
  281.     {
  282.          "9", noIcon, noKey, noMark, plain,
  283.         "10", noIcon, noKey, noMark, plain,
  284.         "12", noIcon, noKey, noMark, plain,
  285.         "14", noIcon, noKey, noMark, plain,
  286.         "16", noIcon, noKey, noMark, plain,
  287.         "18", noIcon, noKey, noMark, plain,
  288.         "24", noIcon, noKey, noMark, plain,
  289.         "36", noIcon, noKey, noMark, plain,
  290.     }
  291. };
  292.  
  293. resource 'CNTL' (CNTL_FirstDayPopup, preload, purgeable) {
  294.     kFirstDayPopupRect,                    /* Must match DITL above            */
  295.     popupTitleLeftJust,                    /* Left-justify                        */
  296.     visible,
  297.     135,                                /* Title width                        */
  298.     MENU_FirstDay,                        /* Font menu                        */
  299.     popupMenuCDEFProc,                    /* It's a popup menu                */
  300.     0,                                    /* refCon, unused                    */
  301.     "First Day of the Week:"            /* Title                            */
  302. };
  303.  
  304. resource 'MENU' (MENU_FirstDay, "First Day of the Week") {
  305.     MENU_Font,
  306.     textMenuProc,
  307.     allEnabled,
  308.     enabled,
  309.     "Fonts",
  310.     {
  311.         "Sunday", noIcon, noKey, noMark, plain,
  312.         "Monday", noIcon, noKey, noMark, plain,
  313.     }
  314. };
  315.  
  316.  
  317. resource 'MBAR' (MBAR_MenuBar) {
  318.     {
  319.         MENU_Apple,
  320.         MENU_File,
  321.         MENU_Edit
  322.     }
  323. };
  324.  
  325. resource 'MENU' (MENU_Apple, "Apple Menu") {
  326.     MENU_Apple,
  327.     textMenuProc,
  328.     0x7FFFFFFC,
  329.     enabled,
  330.     apple,
  331.     {
  332.         "© 1993 Apple Computer Inc.", noIcon, noKey, noMark, plain,
  333.         "-", noIcon, noKey, noMark, plain
  334.     }
  335. };
  336.  
  337. resource 'MENU' (MENU_File, "File Menu") {
  338.     MENU_File,
  339.     textMenuProc,
  340.     allEnabled,
  341.     enabled,
  342.     "File",
  343.     {    
  344.         "Quit", noIcon, "Q", noMark, plain
  345.     }
  346. };
  347.  
  348. resource 'MENU' (MENU_Edit, "Edit Menu") {
  349.     MENU_Edit,
  350.     textMenuProc,
  351.     0x0,
  352.     enabled,
  353.     "Edit",
  354.     {
  355.         "Undo", noIcon, "Z", noMark, plain,
  356.         "-", noIcon, noKey, noMark, plain,
  357.         "Cut", noIcon, "X", noMark, plain,
  358.         "Copy", noIcon, "C", noMark, plain,
  359.         "Paste", noIcon, "V", noMark, plain,
  360.         "Clear", noIcon, noKey, noMark, plain
  361.     }
  362. };
  363.  
  364. resource 'ALRT' (ALRT_NonFatalError, "Non-fatal Error") {        
  365.     {  85,  85, 260, 400 },
  366.     ALRT_NonFatalError,
  367.     {
  368.         OK, visible, silent,
  369.         OK, visible, silent,
  370.         OK, visible, silent,
  371.         OK, visible, silent,
  372.     },
  373. #if SystemSevenOrLater
  374.         alertPositionMainScreen
  375. #endif
  376. };
  377.  
  378. resource 'DITL' (ALRT_NonFatalError, "Non-fatal Error") {
  379.     {
  380.         { 140, 240, 160, 305 },    Button        { enabled,    "Exit" /* kOKButton */    },
  381.         { 140, 140, 160, 230 },    Button        { enabled,    "Continue"                },
  382.         {  26,  86, 130, 305},    StaticText    { disabled,
  383.             "System Error ^0 (^1): ^2"                                            },
  384.     }
  385. };
  386.  
  387. resource 'ALRT' (ALRT_FatalError, "Fatal Error") {        
  388.     {  85,  85, 260, 400 },
  389.     ALRT_FatalError,
  390.     {
  391.         OK, visible, silent,
  392.         OK, visible, silent,
  393.         OK, visible, silent,
  394.         OK, visible, silent,
  395.     },
  396. #if SystemSevenOrLater
  397.         alertPositionMainScreen
  398. #endif
  399. };
  400.  
  401. resource 'DITL' (ALRT_FatalError, "Fatal Error") {
  402.     {
  403.         { 140, 240, 160, 305 },    Button        { enabled,    "Exit"                    },
  404.         {  26,  86, 130, 305},    StaticText    { disabled,
  405.             "Fatal Error ^0 (^1): ^2"                                            },
  406.     }
  407. };
  408.  
  409. resource 'ALRT' (ALRT_WaitForReboot, "Wait for reboot") {
  410.     {  100, 120, 220, 420 },
  411.     ALRT_WaitForReboot,
  412.     {
  413.         OK, visible, silent,
  414.         OK, visible, silent,
  415.         OK, visible, silent,
  416.         OK, visible, silent,
  417.     },
  418. #if SystemSevenOrLater
  419.         alertPositionMainScreen
  420. #endif
  421. };
  422.  
  423. resource 'DITL' (ALRT_WaitForReboot, "Wait for reboot") {
  424.     {
  425.         {  90, 210, 110, 290 },    Button        { enabled,    "OK" /* kOKButton */    },
  426.         {  90,  10, 110,  90 },    Button        { enabled,    "Cancel"                },
  427.         {   5,  65,  85, 293},    StaticText    { disabled,
  428.                 "Changes take effect\n"
  429.                 "after system restart."
  430.             },
  431.     }
  432. };
  433.  
  434. resource 'ALRT' (ALRT_NoPreferences, "No preference resource or file") {        
  435.     {  85,  85, 280, 480 },
  436.     ALRT_NoPreferences,
  437.     {
  438.         OK, visible, silent,
  439.         OK, visible, silent,
  440.         OK, visible, silent,
  441.         OK, visible, silent,
  442.     },
  443. #if SystemSevenOrLater
  444.         alertPositionMainScreen
  445. #endif
  446. };
  447.  
  448. resource 'DITL' (ALRT_NoPreferences, "No preference resource or file") {
  449.     {
  450.         { 160, 320, 180, 385 },    Button        { enabled,    "Exit"                    },
  451.         {  26,  86, 150, 385},    StaticText    { disabled,
  452.             "Can't find the Control Strip preference file.\n"
  453.             "Please check that the MacCalendar Control Strip has been installed"
  454.             " correctly. If you have just installed it, please restart"
  455.             " your computer and try again."
  456.         },
  457.     }
  458. };
  459.  
  460. resource 'STR#' (STRN_Strings, "Various strings") {
  461.     {
  462.         kCalendarPrefName,                    /* Preference resource name        */
  463.         "Geneva",                            /* Font name                    */
  464.         "9",                                /* Font size                    */
  465.         "1",                                /* 1 == Sunday, 2 == Monday        */
  466.         "\001S\001M\002Tu\001W\002Th\001F\001S\000",    /* Day name string    */
  467.     }
  468. };
  469.  
  470. resource 'STR#' (STRN_Messages, "Various messages") {
  471.     {
  472.         "Reading Preference Resource",
  473.         "Writing Preference Resource",
  474.         "System Error",
  475.     }
  476. };
  477.  
  478. type 'Estr' as 'STR ';
  479. resource 'Estr'    (-23)                { "openErr: Can't open file (permissions)"    };
  480. resource 'Estr'    (-27)                { "abortErr: I/O terminated"                };
  481. resource 'Estr'    (-33)                { "dirFulErr: Disk full: can't write data"    };
  482. resource 'Estr'    (-36)                { "ioErr: General I/O error (bummers)"        };
  483. resource 'Estr'    (-41)                { "mFulErr: Memory full (file won't fit)"    };
  484. resource 'Estr'    (-43)                { "fnfErr: File not found"                    };
  485. resource 'Estr'    (-50)                { "paramErr: Error in user parameter block"    };
  486. resource 'Estr'    (-108)                { "memErr: Out of memory"                    };
  487. resource 'Estr' (-109)                { "nilHandleErr: Unexpected NULL handle"    };
  488. resource 'Estr'    (-192)                { "resNotFound: Missing resource"            };
  489. resource 'Estr'    (-4101)                { "No printer selected in Chooser"            };
  490.  
  491. resource 'SIZE' (-1) {
  492.     reserved,
  493.     acceptSuspendResumeEvents,
  494.     reserved,
  495.     canBackground,
  496.     multiFinderAware,
  497.     backgroundAndForeground,
  498.     dontGetFrontClicks,
  499.     ignoreChildDiedEvents,
  500.     is32BitCompatible,
  501.     notHighLevelEventAware,
  502.     onlyLocalHLEvents,
  503.     notStationeryAware,
  504.     dontUseTextEditServices,
  505.     reserved,
  506.     reserved,
  507.     reserved,
  508.     128 * 1024,
  509.     128 * 1024
  510. };
  511.  
  512. resource 'hfdr' (kHMHelpID) {
  513.     HelpMgrVersion, hmDefaultOptions, 0, 0,
  514.     {
  515.         HMStringItem    {
  516.             "MacCalendarSetup\n\n"
  517.              "Use this application to configure the MacCalendar Control Strip module."
  518.         };
  519.     }
  520. };
  521.  
  522.  
  523. #ifdef __powerc
  524. /*
  525.  * All Power PC applications need a code-fragment resource that the code
  526.  * fragment manager uses to facilitate dynamic fragment binding.
  527.  */
  528. #include "CodeFragmentTypes.r"
  529.     
  530. resource 'cfrg' (0) {
  531.     {
  532.         kPowerPC,
  533.         kFullLib,
  534.         kNoVersionNum,
  535.         kNoVersionNum,
  536.         kDefaultStackSize,
  537.         kNoAppSubFolder,
  538.         kIsApp,
  539.         kOnDiskFlat,
  540.         kZeroOffset,
  541.         kWholeFork,
  542.         "MacCalendar"
  543.     }
  544. };
  545. #endif
  546.